import axios from 'axios'
//import { Toast } from 'vant';
//import Cookies from './auth'

// create an axios instance
const service = axios.create({
  baseURL:process.env.VUE_APP_BASE_API,
  // withCredentials: true, // send cookies when cross-domain requests
  timeout: 50000 // request timeout
})

// request拦截器
service.interceptors.request.use(config => {
  // const token = Cookies.get('token')
  // if (token) {
	// 	config.headers = {
	// 	  'Authorization' : token, //携带权限参数
	// 	};
	// }
  return config
}, error => {
  Promise.reject(error)
})

// 响应拦截
service.interceptors.response.use(config => {
  //Toast.clear()
  return config
}, error => {
  //console.log("TTTTTTT-response",error.response)
  Promise.reject(error)
})

export default service
